﻿#region License
/*Copyright (c) 2010 Andrew Collard (andrewcollard@hotmail.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.*/
#endregion

using System.Collections.Generic;

namespace TorchView.Store
{
  /// <summary>
  /// A service that provides file backups and retrieval
  /// </summary>
  public interface IFileStore : IEnumerable<KeyValuePair<string, ICollection<FileBackup>>>
  {
    /// <summary>
    /// Delete a single file backup
    /// </summary>
    /// <param name="fileBackup">File to delete</param>
    /// <returns>true if the deletion succeeded, false if the file could not be deleted</returns>
    bool Delete(FileBackup fileBackup);
    /// <summary>
    /// Delete all files for a specific name
    /// </summary>
    /// <param name="filename">Name of the files to delete</param>
    /// <returns>true if the deletion succeeded, false if the files could not be deleted</returns>
    bool DeleteAll(string filename);
    /// <summary>
    /// Download a file backup
    /// </summary>
    /// <param name="fileBackup">File to retrieve</param>
    /// <param name="targetFile">Destination filename</param>
    /// <returns>true if the download succeeded, false if it failed</returns>
    bool Download(FileBackup fileBackup, string targetFile);
    /// <summary>
    /// Backup a file
    /// </summary>
    /// <param name="filename">Filename of the file to backup</param>
    /// <param name="comment">Comment to attach to this file</param>
    /// <returns>the file that represents the backup</returns>
    FileBackup Store(string filename, string comment = "");
    /// <summary>
    /// Get all files under a specific name
    /// </summary>
    /// <param name="filename">Filename of the files to get</param>
    /// <returns>the collection of files for the specified name</returns>
    ICollection<FileBackup> Get(string filename);
    /// <summary>
    /// Update the comments on a file backup
    /// </summary>
    /// <param name="fileBackup">File to update the comments on</param>
    /// <param name="comment">The new comment to attach to the file</param>
    void UpdateComments(FileBackup fileBackup, string comments);
  }
}
